<?php
namespace app\common\job;

use app\common\model\Cookie;
use app\common\model\UserMain;
use app\common\model\WebSiteCookie;
use think\facade\Cache;
use think\queue\Job;

class Common
{

    public function fire(Job $job, $data)
    {

        echo '开始刷新' . PHP_EOL;

        $refresh_time = Cache::get('refresh_time');
        $now          = date('Y-m-d');
        if (empty($refresh_time) || $refresh_time != $now) {

            UserMain::where('vip_type', '=', '1')->update(['today_times' => 10]);
            UserMain::where('vip_type', '=', '0')->update(['today_times' => 10]);

            Cache::set('refresh_time', $now);

            echo '刷新完成' . PHP_EOL;
        }else{
            return;
        }
    }

    public function failed($data)
    {
    }




}
